import java.util.HashSet;
import java.util.Scanner;

public class LengthOfLongestSubstring {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String ss = scanner.nextLine();
        HashSet<Character> set = new HashSet<>();
        int count = 0;
        int max[] = new int[20];
        // 遍历string，将每一个char对应的是否已经出现过映射在set中

        for (int j = 0; j < ss.length(); j++) {
            int index = 0;
            set = new HashSet<>();
            for (int i = j; i < ss.length(); i++) {
                if(set.contains(ss.charAt(i))){
                    max[index++] = count;
                    count = 1;
                    set = new HashSet<Character>();
                    set.add(ss.charAt(i));
                }else{
                    set.add(ss.charAt(i));
                    count++;
                    if(i == ss.length() - 1){
                        max[index++] = count;
                    }
                }
            }
        }

        int res =  max[0];
        for (int i = 0; i < max.length; i++) {
            if(res < max[i]){
                res = max[i];
            }
        }

        System.out.println(res);
    }
}
